package com.kpf.springcloud.task;

import com.kpf.springcloud.service.IKpfTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * 定时器, 定时更新权重
 *
 * @author shiwen
 * @date 2021/4/6
 */

@Configuration
public class KpfSortNoTask {

    @Autowired
    private IKpfTopicService topicService;

    /**
     * 两分钟更新一次权重值
     */
    @Scheduled(cron = "0 */2 * * * ?")
    public void initTopicSortNo() {
        topicService.initTopicSortNo();
    }

    /**
     * 一分钟更新一次阅读量
     */
    @Scheduled(cron = "0 */1 * * * ?")
    public void initTopicVisitData() {
        topicService.initTopicVisitData();
    }

}